Component({
  data: {
    selected: 0,
    list: [
      {
        pagePath: "/pages/home/index",
        text: "首页",
        iconPath: "/assets/icons/home.png",
        selectedIconPath: "/assets/icons/home-active.png"
      },
      {
        pagePath: "/pages/boat/index",
        text: "渔船",
        iconPath: "/assets/icons/boat.png",
        selectedIconPath: "/assets/icons/boat-active.png"
      },
      {
        pagePath: "/pages/home/index",
        text: "",
        iconPath: "/assets/icons/camera.png",
        selectedIconPath: "/assets/icons/camera.png",
        isSpecial: true
      },
      {
        pagePath: "/pages/fishing/index",
        text: "捕捞",
        iconPath: "/assets/icons/fishing.png",
        selectedIconPath: "/assets/icons/fishing-active.png"
      },
      {
        pagePath: "/pages/profile/index",
        text: "我的",
        iconPath: "/assets/icons/profile.png",
        selectedIconPath: "/assets/icons/profile-active.png"
      }
    ]
  },
  methods: {
    switchTab(e) {
      const data = e.currentTarget.dataset;
      const url = data.path;
      
      // 处理拍照按钮点击
      if (data.index === 2) {
        wx.chooseImage({
          count: 1,
          sizeType: ['compressed'],
          sourceType: ['camera'],
          success: (res) => {
            // 处理拍照后的图片
            console.log(res.tempFilePaths[0]);
            // 这里可以添加上传图片或其他处理逻辑
          }
        });
        return;
      }

      wx.switchTab({ url });
      this.setData({
        selected: data.index
      });
    }
  }
}); 